<template>
  <div class="account">
    <el-container>
      <el-header>
        <el-breadcrumb>
          <el-breadcrumb-item>商品维护</el-breadcrumb-item>
          <el-breadcrumb-item>商品审核</el-breadcrumb-item>
        </el-breadcrumb>
      </el-header>
      <el-main>
        <div class="main-header">
          <span class="supplier-name">供应商名称:</span>
          <el-input v-model="supplierInput" placeholder="请输入内容" size="small"></el-input>
          <span class="shop-name">商品名称:</span>
          <el-input v-model="shopInput" placeholder="请输入内容" size="small"></el-input>
          <el-button type="primary" size="small">查询</el-button>
          <el-button size="small">重置</el-button>
        </div>
        <div class="main-content">
          <div class="table-data">
            <el-table :data="tableData" border style="width: 100%">
              <el-table-column prop="order" label="序号" width="50" align="center"></el-table-column>
              <el-table-column prop="supplier" label="供应商" width="100" align="center"></el-table-column>
              <el-table-column prop="prdtId" label="商品ID" width="140" align="center"></el-table-column>
              <el-table-column prop="prdtName" label="商品名称" width="80" align="center"></el-table-column>
              <el-table-column prop="prdtType" label="商品类型" align="center"></el-table-column>
              <el-table-column prop="prdtPrice" label="商品价格" width="130" align="center"></el-table-column>
              <el-table-column prop="prdtValid" label="商品有效期" align="center"></el-table-column>
              <el-table-column prop="prdtSurplus" label="剩余商品库存" width="110" align="center"></el-table-column>
              <el-table-column prop="prdtStatus" label="审核状态" width="90" align="center"></el-table-column>
              <el-table-column align="center" width="120">
                <template slot-scope="scope">
                  <el-button type="text" size="small" @click="resetResource(scope.row)">查看</el-button>
                  <el-button type="text" size="small" @click="deleteBtnClick(scope.row)">审核</el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <div class="pageination">
          <el-pagination
            background
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync="currentPage"
            :page-sizes="[10, 15, 20]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="100"
          ></el-pagination>
        </div>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 顶部搜索框
      supplierInput: "",
      shopInput: "",
      // 回显数据
      tableData: [
        {
          order: 1,
          supplier: '四方精创',
          prdtId: 'SKSNFKFOA',
          prdtName: '礼券',
          prdtType: '酒店会所-星级酒店',
          prdtPrice: '现金： 88.00',
          prdtValid: '2020-01-01 - 2020-01-30',
          prdtSurplus: 10,
          prdtStatus: '待审核'
        },
        {
          order: 2,
          supplier: '四方精创',
          prdtId: 'SKSNFdssaKFOA',
          prdtName: '礼券',
          prdtType: '酒店会所-星级酒店',
          prdtPrice: '现金： 88.00',
          prdtValid: '2020-01-01 - 2020-01-30',
          prdtSurplus: 10,
          prdtStatus: '通过'
        }
      ],
      currentPage:1
    };
  },
  methods: {
    // 新增
    addTypeBtnClick() {
      console.log("新增分类");
    },
    // 行内按钮
    addChildBtnClick(row) {
      console.log(row, "添加子分类");
    },
    resetResource(row) {
      console.log(row, "编辑");
    },
    setBtnClick(row) {
      console.log(row, "编辑");
    },
    deleteBtnClick(row) {
      console.log(row, "删除");
    },
    // 分页每页条数以及翻页
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  }
};
</script>

<style scoped>
.account .el-header {
  height: 60px;
  border-bottom: 1px solid #f3f3f3;
}
.el-breadcrumb {
  height: 60px;
  line-height: 60px;
}
.main-header {
  text-align: center;
  align-items: center;
  display: flex;
  margin-bottom: 20px;
}
.main-header >>> .el-input {
  width: 200px;
  margin-right: 20px;
}
.main-content {
  margin: 40px;
}
.supplier-name {
  width: 100px;
} 
.shop-name {
  width: 130px;
  display: inline-block;
}
.pageination {
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>